package org.forex.impl.ws;

import java.io.IOException;
import java.util.HashMap;
import java.util.Optional;

import org.forex.vo.Order;

public class MakeOrder extends AbstractHttpCallImpl<Order> {

	private static String accountId="9646994";

	public MakeOrder() {
		super(Order.class);
		parameters=new HashMap<String, String>();
		parameters.put("type","market");
	}

	public Optional<Order> post(String instrumentCode,Long units,String side) throws IOException{
		
		parameters.put("instrument",instrumentCode);
		parameters.put("units",units.toString());
		parameters.put("side",side);
		
		return call("/v1/accounts/"+accountId+"/orders");
	}

	@Override
	public String getHttpMethod() {
		return POST;
	}

}
